# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import crypt
from .controllers import JsonApi
from odoo import http, api
import logging
_logger = logging.getLogger(__name__)


class JsonApi2(JsonApi):
    # 带加密的 api , 暂时留在这儿 称为历史

    @http.route('/api/logout2', type='json', auth='user', cors='*', csrf=False)
    @crypt.decode
    def destroy2(self):
        self._destroy()

    @http.route('/api/login2', type='json', auth='none', cors='*', csrf=False)
    @crypt.decode
    def login2(self, db, login, password, **kw):
        return self._login(db, login, password, **kw)

    @http.route('/api/call2', type='json', auth='user', cors='*', csrf=False)
    @crypt.decode
    def api_call2(self, model, method, args, kwargs, sudo=None):
        return self._api_call(model, method, args, kwargs)
